module PaginacaoHelper
  def paginar(collection)
    unless collection.class == Array 
      pagination_for_links = will_paginate collection, :prev_label   => '&lt;&lt;Anterior',
                                                       :next_label   => 'Próximo&gt;&gt;',
                                                       :param_name   => :pagina,
                                                       :inner_window => 2,
                                                       :outer_window => 2
      """
        <table style=\"width: 100%;\">
          <tr>
            <td class=\"TextFormat\">
              Página #{collection.current_page} de #{collection.page_count} com #{collection.size} de #{collection.total_entries} registros
            </td>
            <td style=\"text-align: right;\">
              #{pagination_for_links if collection.page_count > 1}
            </td>
          </tr>
        </table>
      """
    end if collection
  end
  alias paginacao            paginar
  alias paginate             paginar
  alias custom_will_paginate paginar
end